/**
  \file Splash.qml
\brief Splash image shown at startup

\author © 2011 Enrico Miglino / Tech Consulting (enrico.miglino@ovi.com)
\author "Black Cat Cutting Studio" is protected by the copyright law
\author Distributed under the LGPL 3.0 license.
\version 1.0 alpha
\date 2011

\par Black Cat Cutting Studio licensing notes

    "Black Cat Cutting Studio" is free software: you can redistribute it
    and/or modify it under the terms of the Lesser GNU General Public License
    as published by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    "Black Cat Cutting Studio" is distributed in the hope that it
    will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    Lesser GNU General Public License for more details.

    You should have received a copy of the Lesser GNU General Public License
    along with "Black Cat Cutting Studio".
    If not, see <http://www.gnu.org/licenses/>.

*/
import QtQuick 1.0

// Spash screen image shown when program starts
Item {
    id: splashscreen

    property alias splashshowing: waitcycle.running
    //changes to trigger the behavioral animation of the image
    property bool splashended: false

    // Timer used to wait showing the splash screen. When timer stops, trigger change
    // the state of splash shown flags so the image is removed from the screen.
    // Note: if running is set to false, timer should be activated by an external event
    //       i.e. the power button.
    Timer {
        id: waitcycle
        interval: 3000; running: false; repeat: false
        onTriggered: {
            splashended = true;
        }
    }

    // Splash Image to be shown
    Image {
        id: splashimage

        fillMode: Image.PreserveAspectFit
        width: parent.width
        height: parent.height
        opacity: 1
        source: "../images/SplashScreen.png"
    }

    // Smooth disappear the splash image
    Behavior on splashended {
            NumberAnimation { target: splashimage; property: "opacity"; to: 0; duration: 1000 }
        }
}

